package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"private-domain-overseas-service/pkg/status/bizmall"
	"time"
)

type HzMallBrand struct {
	ent.Schema
}

func (HzMallBrand) Fields() []ent.Field {
	return []ent.Field{
		field.String("mall_brand_icon").Optional().Comment("品牌图标"),
		field.String("mall_brand_name").Optional().Comment("品牌名称"),
		field.String("mall_brand_url").Optional().Comment("品牌地址"),
		field.Int64("mall_brand_sort").Default(1).Optional().Comment("品牌排序，数字越大越靠前"),
		field.Int64("mall_brand_parent_id").Default(0).Comment("父级品牌ID"),
		field.Int64("mall_brand_site_id").Optional().Comment("品牌站点Id,为0则代表品牌数据"),
		field.Int64("mall_brand_site_status").Default(bizmall.SiteUnlock).Comment("品牌站点状态 1.解锁 2.未解锁"),
		field.Int64("mall_brand_site_show").Default(bizmall.IsShow).Comment("站点中在app内是否展示，1 展示 2 不展示"),
		field.Int64("brand_commission_rate").Optional().Comment("品牌佣金比例"),
		field.Int64("created_at").Immutable().Default(time.Now().Unix()).Comment("创建时间"),
		field.Int64("update_at").Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

// Indexes of the Street.
func (HzMallBrand) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("mall_brand_sort"),
	}
}

func (HzMallBrand) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("品牌表-站点表"),
	}
}
